package com.zhang.apipassenger.service.impl;

import com.zhang.apipassenger.remote.ServicePriceClient;
import com.zhang.apipassenger.service.ForecastPriceService;
import com.zhang.internalcommon.dto.ForecastPrceDTO;
import com.zhang.internalcommon.dto.ResponseResult;
import com.zhang.internalcommon.response.ForecastPriceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ForecastServiceImpl implements ForecastPriceService {
	@Autowired
	private ServicePriceClient servicePriceClient;

	@Override
	public ResponseResult forecastPrice(String depLongitude, String depLatitude, String destLongitude, String destLatitude, String cityCode, String vehicleType) {
		ForecastPrceDTO forecastPrceDTO = new ForecastPrceDTO();
		forecastPrceDTO.setDepLongitude(depLongitude);
		forecastPrceDTO.setDepLatitude(depLatitude);
		forecastPrceDTO.setDestLongitude(destLongitude);
		forecastPrceDTO.setDestLatitude(destLatitude);
		forecastPrceDTO.setCityCode(cityCode);
		forecastPrceDTO.setVehicleType(vehicleType);
		// ForecastPriceResponse forecastPriceResponse = new ForecastPriceResponse();
		ResponseResult<ForecastPriceResponse> responseResult = servicePriceClient.forecastPrice(forecastPrceDTO);
		// double price = responseResult.getData().getPrice();
		// forecastPriceResponse.setPrice(price);
		// forecastPriceResponse.setCityCode(cityCode);
		// forecastPriceResponse.setVehicleType(vehicleType);
		return ResponseResult.success(responseResult);
	}
}
